﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                    xmlns:Collections="clr-namespace:System.Collections;assembly=mscorlib"
                    xmlns:ActionParameters="clr-namespace:Adan.Client.Model.ActionParameters" 
                    xmlns:System="clr-namespace:System;assembly=mscorlib" 
                    xmlns:Actions="clr-namespace:Adan.Client.Model.Actions" 
                    xmlns:Controls1="clr-namespace:Adan.Client.Common.Controls;assembly=Adan.Client.Common">
    <Controls1:GenericTemplateSelector x:Key="GenericTemplateSelector" />
    <Collections:ArrayList x:Key="MathOperations" >
        <ActionParameters:MathOperation>Plus</ActionParameters:MathOperation>
        <ActionParameters:MathOperation>Minus</ActionParameters:MathOperation>
        <ActionParameters:MathOperation>Multiplication</ActionParameters:MathOperation>
        <ActionParameters:MathOperation>Division</ActionParameters:MathOperation>
    </Collections:ArrayList>
    <Collections:ArrayList x:Key="ActionConditionTypes">
        <Actions:ActionCondition>Equals</Actions:ActionCondition>
        <Actions:ActionCondition>NotEquals</Actions:ActionCondition>
        <Actions:ActionCondition>Greater</Actions:ActionCondition>
        <Actions:ActionCondition>GreaterOrEquals</Actions:ActionCondition>
        <Actions:ActionCondition>Less</Actions:ActionCondition>
        <Actions:ActionCondition>LessOrEquals</Actions:ActionCondition>
        <Actions:ActionCondition>IsEmpty</Actions:ActionCondition>
        <Actions:ActionCondition>IsNotEmpty</Actions:ActionCondition>
    </Collections:ArrayList>
    <DataTemplate x:Key="ConstantStringParameterViewModelTemplate" DataType="ConstantStringParameter">
        <StackPanel>
            <Label VerticalAlignment="Bottom">Constant string:</Label>
            <TextBox Text="{Binding Path=ConstantString, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch"/>
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="TriggerOrCommandParameterViewModelTemplate" DataType="TriggerOrCommandParameter">
        <StackPanel>
            <Label VerticalAlignment="Bottom">Parameter number:</Label>
            <ComboBox  SelectedValuePath="Tag" SelectedValue="{Binding Path=ParameterNumber}" Width="200" HorizontalAlignment="Left">
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>0</System:Int32>
                    </ComboBoxItem.Tag>
                    Entire string
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>1</System:Int32>
                    </ComboBoxItem.Tag>
                    1
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>2</System:Int32>
                    </ComboBoxItem.Tag>
                    2
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>3</System:Int32>
                    </ComboBoxItem.Tag>
                    3
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>4</System:Int32>
                    </ComboBoxItem.Tag>
                    4
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>5</System:Int32>
                    </ComboBoxItem.Tag>
                    5
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>6</System:Int32>
                    </ComboBoxItem.Tag>
                    6
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>7</System:Int32>
                    </ComboBoxItem.Tag>
                    7
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>8</System:Int32>
                    </ComboBoxItem.Tag>
                    8
                </ComboBoxItem>
                <ComboBoxItem>
                    <ComboBoxItem.Tag>
                        <System:Int32>9</System:Int32>
                    </ComboBoxItem.Tag>
                    9
                </ComboBoxItem>
            </ComboBox>
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="VariableReferenceParameterViewModelTemplate" DataType="VariableReferenceParameter">
        <StackPanel>
            <Label VerticalAlignment="Bottom">Variable name:</Label>
            <ComboBox Text="{Binding Path=VariableName, UpdateSourceTrigger=PropertyChanged}"  ItemsSource="{Binding Path=AllVariables}" DisplayMemberPath="Name" IsEditable="True" Width="200"  HorizontalAlignment="Left" />
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="MathExpressionParameterViewModelTemplate" DataType="MathExpressionParameter">
        <StackPanel Margin="0,5,0,0">
            <Border Margin="10,2,2,2" Padding="2" BorderBrush="Black" BorderThickness="1"  CornerRadius="2,2,2,2">
                <StackPanel Orientation="Vertical">
                    <Label VerticalAlignment="Center">Operand 1:</Label>
                    <ComboBox Width="200" HorizontalAlignment="Left" SelectedValue="{Binding Path=FirstOperandDescriptor}" ItemsSource="{Binding Path=AllParameterDescriptions}" DisplayMemberPath="DisplayName"/>
                    <ContentControl Content="{Binding Path=FirstOperand}" Grid.Column="1" Margin="2,0,2,2" ContentTemplateSelector="{DynamicResource GenericTemplateSelector}"/>
                </StackPanel>
            </Border>
            <ComboBox Width="100" HorizontalAlignment="Left" SelectedValue="{Binding Path=Operation}" ItemsSource="{StaticResource MathOperations}" Margin="0,5,0,5"/>
            <Border Margin="10,2,2,2" Padding="2" BorderBrush="Black" BorderThickness="1"  CornerRadius="2,2,2,2">
                <StackPanel Orientation="Vertical">
                    <Label VerticalAlignment="Center">Operand 2:</Label>
                    <ComboBox Width="200" HorizontalAlignment="Left" SelectedValue="{Binding Path=SecondOperandDescriptor}" ItemsSource="{Binding Path=AllParameterDescriptions}" DisplayMemberPath="DisplayName"/>
                    <ContentControl Content="{Binding Path=SecondOperand}" Grid.Column="1" Margin="2,0,2,2" ContentTemplateSelector="{DynamicResource GenericTemplateSelector}"/>
                </StackPanel>
            </Border>
        </StackPanel>
    </DataTemplate>
</ResourceDictionary>